/*
 * test_log.cpp
 *
 *  Created on: Jan 8, 2014
 *      Author: killerg
 */


#include <string>
#include <fcntl.h>

#include "share/util.h"

using namespace std;

bool test_log() {
	string file_path = fmt_cstr("%s/log/server_order_log.txt", get_deploy());
    int log_fd = open(file_path.c_str(), O_CREAT | O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR);
    if (log_fd < 0)
        return false;

    for (int i=0; i<10; ++i) {
    	const char* str = fmt_cstr("%d\n", i);
    	write(log_fd, str, strlen(str));
    }

    close(log_fd);

    return true;
}
